package com.aaa.service.impl;

import com.aaa.commen.domain.RentExpireAndOverdue;
import com.aaa.commen.entity.Result;
import com.aaa.commen.query.RentExpireQuery;
import com.aaa.commen.query.RentOverdueQuery;
import com.aaa.mapper.RentExpireAndOverdueMapper;
import com.aaa.service.IRentExpireAndOverdueService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @PackageName: com.aaa.service.impl
 * @ClassName: IRentExpireAndOverdueServiceImpl
 * @Description:
 * @author: 王嘉威
 * @Date: 2021/1/27 17:27
 */
@Service
public class RentExpireAndOverdueServiceImpl extends ServiceImpl<RentExpireAndOverdueMapper, RentExpireAndOverdue> implements IRentExpireAndOverdueService {

    @Autowired
    private RentExpireAndOverdueMapper rentExpireAndOverdueMapper;

    /**
     * 查询所有租金即将到期信息
     * @return
     */
    @Override
    public Result queryRentExpire(RentExpireQuery rentExpireQuery) {
        IPage<RentExpireAndOverdue> rentExpire = rentExpireAndOverdueMapper.queryRentExpire(new Page<RentExpireAndOverdue>(rentExpireQuery.getCurrPage(), rentExpireQuery.getCount()), rentExpireQuery);
        return Result.success(rentExpire);
    }

    /**
     * 查询所有租金逾期信息
     * @return
     */
    @Override
    public Result queryRentOverdue(RentOverdueQuery rentOverdueQuery) {
        IPage<RentExpireAndOverdue> rentOverdue = rentExpireAndOverdueMapper.queryRentOverdue(new Page<RentExpireAndOverdue>(rentOverdueQuery.getCurrPage(), rentOverdueQuery.getCount()), rentOverdueQuery);
        return Result.success(rentOverdue);
    }
}
